package com.loadmore.common.dao.gen;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.loadmore.common.model.Category;
import com.loadmore.common.model.Schedule;
import com.loadmore.common.model.User;

import com.loadmore.common.dao.gen.CategoryDao;
import com.loadmore.common.dao.gen.ScheduleDao;
import com.loadmore.common.dao.gen.UserDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig categoryDaoConfig;
    private final DaoConfig scheduleDaoConfig;
    private final DaoConfig userDaoConfig;

    private final CategoryDao categoryDao;
    private final ScheduleDao scheduleDao;
    private final UserDao userDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        categoryDaoConfig = daoConfigMap.get(CategoryDao.class).clone();
        categoryDaoConfig.initIdentityScope(type);

        scheduleDaoConfig = daoConfigMap.get(ScheduleDao.class).clone();
        scheduleDaoConfig.initIdentityScope(type);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        categoryDao = new CategoryDao(categoryDaoConfig, this);
        scheduleDao = new ScheduleDao(scheduleDaoConfig, this);
        userDao = new UserDao(userDaoConfig, this);

        registerDao(Category.class, categoryDao);
        registerDao(Schedule.class, scheduleDao);
        registerDao(User.class, userDao);
    }
    
    public void clear() {
        categoryDaoConfig.clearIdentityScope();
        scheduleDaoConfig.clearIdentityScope();
        userDaoConfig.clearIdentityScope();
    }

    public CategoryDao getCategoryDao() {
        return categoryDao;
    }

    public ScheduleDao getScheduleDao() {
        return scheduleDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

}
